package itsm.isperp.module.controller.app;

import itsm.isperp.framework.core.context.ContextHolder;
import itsm.isperp.framework.service.BaseService;
import itsm.isperp.framework.web.controller.BaseController;
import itsm.isperp.framework.web.request.JqGridFilterRuleOp;
import itsm.isperp.framework.web.request.JqGridRequest;
import itsm.isperp.module.entity.app.AppLoginLog;
import itsm.isperp.module.service.app.AppLoginLogService;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 菜单资源管理控制器
 * 
 * @author lizx
 * @date 2013-1-15
 * @version V1.0
 */
@Controller
@RequestMapping("app/loginLog")
public class AppLoginLogController extends BaseController<AppLoginLog> {

	@Autowired
	protected AppLoginLogService appLoginLogService;

	@Override
	public BaseService<AppLoginLog> getService() {
		return this.appLoginLogService;
	}

	@Override
	public String getPageTitle() {
		return "登录日志";
	}

	@RequestMapping("listByUsername")
	@ResponseBody
	public Page<AppLoginLog> listByUsername(JqGridRequest request,
			HttpServletRequest req) {
		request.addFilterRule("username", JqGridFilterRuleOp.eq,
				ContextHolder.getLoginUsername());
		return super.list(request, req);

	}

}
